<template>
  <dialog-editor ref="dialog"></dialog-editor>
</template>

<script>
import DialogEditor from '@/components/DialogEditor'
import dialogMixins from '@/utils/commonDialogMixins'

export default {
  mixins: [dialogMixins],
  components: {DialogEditor},
  data() {
    return {
      dataFormConfig: {
        id: {
          hidden: true
        },
        modelInfoId: {
          label: '模具入库id',
          placeholder: '请输入模具入库id'
        },
        modelType: {
          label: '模具状态',
          type: 'switch',
          activeValue: 1,
          inactiveValue: 0,
          default: 1
        }
      }
    }
  },
  methods: {
    init(id) {
      this.dataForm.id = id || 0

      this.$refs.dialog.initDialog({
        dataForm: this.dataForm,
        config: this.dataFormConfig,
        dataRule: this.getNeedDataRule('modelInfoId', 'modelType'),
        initApi: 'modelApi/modelMessageInfo',
        saveApi: 'modelApi/saveModelMessage',
        updateApi: 'modelApi/updateModelMessage',
        objectName: 'modelInfo'
      })
    }
  }
}
</script>
